package com.fqgj.sentry.policy.enums;

/**
 * Created by zwh @yuntu-inc.com
 *
 * @description
 * @create 2017/7/31 0031 上午 9:39
 */
public enum ColumnDateTypeEnum {
    date_data(1, "日期", "DATE"),
    decimals_data(2, "小数", "DOUBLE"),
    integer_data(3, "整数", "INT"),
    string_data(4, "字符串", "STRING");

    private Integer type;
    private String desc;
    private String policyDesc;

    ColumnDateTypeEnum(Integer type, String desc, String policyDesc) {
        this.type = type;
        this.desc = desc;
        this.policyDesc = policyDesc;
    }

    public static String getDesc(Integer type) {
        for (ColumnDateTypeEnum columnDateTypeEnum : ColumnDateTypeEnum.values()) {
            if (columnDateTypeEnum.getType().equals(type)) {
                return columnDateTypeEnum.getDesc();
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public String getPolicyDesc() {
        return policyDesc;
    }

    public static ColumnDateTypeEnum getEnumByType(int type) {
        ColumnDateTypeEnum columnDateTypeEnum = null;
        for (ColumnDateTypeEnum e : ColumnDateTypeEnum.values()) {
            if (e.getType() == type) {
                return e;
            }
        }
        return columnDateTypeEnum;
    }

}